#ifndef TRAJECTORY_3D
#define TRAJECTORY_3D
#include <Define.h>
#include <osg/MatrixTransform>
#include <osg/ShapeDrawable>
#include <osg/LineWidth>
#include <Point3D.h>
#include <osg/AnimationPath>
class OSG_EDITOR_DLL Trajectory3D : public osg::MatrixTransform
{
public:
    Trajectory3D();
    Trajectory3D(const Trajectory3D &trajectory3D, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY);
    virtual ~Trajectory3D();

    //virtual osg::Object * cloneType () const;
    //virtual osg::Object * clone (const osg::CopyOp &copyop) const;

    virtual bool addChild(osg::Node* child);
    virtual bool removeChildren (unsigned int pos, unsigned int numChildrenToRemove);

    void updatePointPosition(Point3D* pointPtr);

    void setLineWidth(double lineWidth);
    double getLineWidth();

    void setLineColor(const osg::Vec4& lineColor);
    osg::Vec4 getLineColor();

    void setDurationTime(double durationTime);
    double getDurationTime();

    void setMTName(const std::string& mtName);
    std::string getMTName();

    void setMTPtr(osg::ref_ptr<osg::MatrixTransform> mtPtr);
    osg::ref_ptr<osg::MatrixTransform> getMTPtr();

    void setLoopMode(osg::AnimationPath::LoopMode loopMode);
    osg::AnimationPath::LoopMode getLoopMode();

    void setAnimatEnable(bool boolValue);
    bool getAnimatEnable();

    void setTimeOffset(double timeOffset);
    double getTimeOffset();
protected:
    void buildChildNode();
    bool checkPoint3DInChildren(osg::Node* child);
    void updatePointVector();
    void updateAnimationPath();
private:
    osg::ref_ptr<osg::Vec3Array> m_pointVector;
    osg::ref_ptr<osg::Geode> m_geode;
    osg::ref_ptr<osg::Geometry> m_geom;
    osg::ref_ptr<osg::LineWidth> m_lineWidth;
    osg::ref_ptr<osg::Vec4Array> m_colorArray;
    osg::ref_ptr<osg::AnimationPath> m_animationPath;
    double m_durationTime;
    std::vector<osg::Matrix> m_matrixVector;
    osg::ref_ptr<osg::MatrixTransform> m_mtPtr;

    bool m_animatEnable;
    double m_timeOffset;
};



#endif //TRAJECTORY_3D
